$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("p_form_gctzch_m")
    const dgrid1 = $NG.getCmpApi("")
    const getHeadValue = (str) => mstform.getItem(str).getValue()
    const param = parseUrlParams(location.href)
    if (param.sourceid && !mstform.getItem("u_lyid").getValue()) { 
        mstform.getItem("u_lyid").setValue(param.sourceid)
    }

    function parseUrlParams(url) {
        // 分离URL的哈希部分
        const hashIndex = url.indexOf('#');
        if (hashIndex === -1) return {};

        const hashPart = url.substring(hashIndex + 1);

        // 分离哈希路径和查询参数
        const questionMarkIndex = hashPart.indexOf('?');
        if (questionMarkIndex === -1) return {};

        const queryString = hashPart.substring(questionMarkIndex + 1);

        // 解析查询参数
        const params = {};
        queryString.split('&').forEach(param => {
            const [key, value] = param.split('=');
            if (key && value !== undefined) {
                params[key] = decodeURIComponent(value);
            }
        });

        return params;
    }
})